Skip to main content

All Questions

Tagged with
0votes
2answers
116views

How to copy the value from one "column" to another in Bash?

I have a file with lines: username="user1" email="[email protected]" I need to take the username from the email address and replace the username value with it, so the end result ...
Vladimir Terentyev's user avatar
-1votes
2answers
141views

how to de-duplicate block (timestamp+command) from bash history?

I'm working with bash_history file containing blocks with the following format: #unixtimestamp\ncommand\n here's sample of the bash_history file: #1713308636 cat > ./initramfs/init << "...
ReYuki's user avatar
6votes
13answers
2kviews

UNIX command to add comma and space

I have a file that looks like $ cat IP 10.3.1.1 10.4.1.1 10.6.3.1 10.19.4.2 10.22.3.4 How do I make it look like: $ cat IP 10.3.1.1, 10.4.1.1, 10.6.3.1, 10.19.4.2, 10.22.3.4
Shahriar Flamneco's user avatar
-3votes
4answers
140views

Print between two patterns on a single line

I have a file with the following contents: <alarm="yes"> <moduleId>aaa</moduleId> <documentation> <description>bbb</description> <Object>ccc</...
ashutosh's user avatar
0votes
0answers
147views

Sendmail entry in /etc/aliases that modifies the email header before sending it out?

I'm using Sendmail I want to create an alias in /etc/aliases, that modifies the To: line before sending out the message . I assume I need some sort of script or command that the email is piped into. ...
user1993015's user avatar
0votes
2answers
130views

Is it bad practice to use sed to pass a variable through to another script? [closed]

There are two shell scripts. One of which is a source file source.sh. This source file will exist for multiple people each with their own directories. name = "foo" The main script main.sh ...
Asteck's user avatar
1vote
2answers
669views

get latest file on github via script

I am trying to do the same for https://github.com/eneshecan/whatsapp-for-linux/releases as is described here: Download and install latest deb package from github via terminal but cant get it to work, ...
Questi's user avatar
2votes
2answers
2kviews

Sed based on 2 words, then replace whole line with variable

I have a txt file looking like this, 1:Ana:apple:08:00:wait 1:Joe:banana:08:30:wait 1:Oscar:orange:08:45:ready 1:Monica:apple:08:50:ready 1:Mark::orange:ready I have to find only the first line that ...
Claudio Del Prete's user avatar
1vote
1answer
112views

How to delete a string in my files?

So I want to match all below then remove those lines of string. [MTT-5634](https://my.atlassian.net/browse/MTT-5634) [MCC-123](https://my.atlassian.net/browse/MCC-123) [MTT-7965]: https://my.atlassian....
Beelzebub's user avatar
-1votes
2answers
123views

line start string and end string matches then it needs to replace end string of a line and ignore any string that matches in between of same line

Require a shell script for the below issue elecj_test: |1009676|F|269.13348200|3|348415|237.06|0.00|0.00|||SSPPPSSSPSSS|UNTESTED|| If a line starts with elecj_test: and ends with || it needs to ...
sathavahana's user avatar
0votes
1answer
971views

reload the i3 conf in a script

i am writing a script to quick change the mod key of i3 conf0="/home/myuser/.config/i3/config" case "${1}" in (alt) key=Mod1 ;; (win) key=Mod4 ;; (*) printf "Invalid ...
fabolous05's user avatar
1vote
2answers
134views

how to create a csh script that can identify the correct USB disk where I have saved my virtual machines

I'm running Freebsd 13R and as shell I'm using csh. I would like to create a script,that looks the presence of the word "r1w1e2" or "NM13N4CZ" or "3e4d31334e34435a" when ...
Marietto's user avatar
0votes
1answer
836views

Only perform sed operations on lines starting with a particular string [closed]

I have the following file format Received from +11231231234 at 2021-10-10T19:56:50-07:00: This is a message that contains words like from, at, etc. Sent to +11231231234 at 2021-10-11T06:50:57+00:00: ...
jf4i2d's user avatar
0votes
2answers
317views

How to create a sed script to replace quotes in a file? [duplicate]

So I manually use the following two commands in succession on my data file, i.e. I trigger the second command after the first has finished updating the file: sed -i 's/""""/" &...
BasicQs's user avatar
2votes
3answers
449views

How to get the average of multiple data in a row from multiple folders

My data inside a folder data looks like data1.txt, data2.txt, … data120.txt. Inside each .txt file I have four columns (1000 data lines in each column) example: data1.txt 1 2 3 4 4 0 1 3 3 1 1 2 2 ...
saya's user avatar

153050per page
close